package com.yserp.project.erp.order.saleorder.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yserp.common.utils.mybatis.MybatisPlusUtil;
import com.yserp.project.erp.order.saleorder.domain.ErpSaleOrderItem;
import com.yserp.project.erp.order.saleorder.mapper.ErpSaleOrderItemMapper;
import com.yserp.project.erp.order.saleorder.service.IErpSaleOrderItemService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 销售订单子Service业务层处理
 *
 * @author yserp
 * @date 2022-07-07
 */
@Service
public class ErpSaleOrderItemServiceImpl extends ServiceImpl<ErpSaleOrderItemMapper,ErpSaleOrderItem> implements IErpSaleOrderItemService {
    @Resource
    private ErpSaleOrderItemMapper erpSaleOrderItemMapper;


    /**
     * 查询销售订单子列表
     *
     * @param erpSaleOrderItem 销售订单子
     * @return 销售订单子
     */
    @Override
    public List<ErpSaleOrderItem> selectErpSaleOrderItemList(ErpSaleOrderItem erpSaleOrderItem) {
        QueryWrapper<ErpSaleOrderItem> queryWrapper = new QueryWrapper<>();
        MybatisPlusUtil.notNullField(erpSaleOrderItem,queryWrapper);
        return erpSaleOrderItemMapper.selectList(queryWrapper);
    }

    /**
     * 查询销售订单子
     *
     * @param mainId 销售订单主主键
     * @return 销售订单子
     */
    @Override
    public List<ErpSaleOrderItem> selectErpSaleOrderItemByMainId(Long mainId) {
        ErpSaleOrderItem erpSaleOrderItem = new ErpSaleOrderItem();
        erpSaleOrderItem.setSaleOrderId(mainId);
        return this.selectErpSaleOrderItemList(erpSaleOrderItem);
    }


}
